package planit.controller.impl;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import planit.model.Model;
import planit.view.AddPersonToEventDialog;

@SuppressWarnings("serial")
public class RemovePersonFromEventController extends AbstractAction {

	private Model model;

	public RemovePersonFromEventController(Model model) {
		this.model = model;
	}

	@Override
	public void actionPerformed(ActionEvent arg0) {
		AddPersonToEventDialog dialog = (AddPersonToEventDialog) this
				.getValue("RemovePersonFromEventDialog");

		model.getSchedule().getEvent(dialog.getEventId()).removePerson(
				model.getSchedule().getPerson(dialog.getPersonInEventId()));

		dialog.updateEventPersonsList();

	}
}
